using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Product.Api.Controllers
{
    [Authorize]
    [ApiController]
    [Route("[controller]")]
    public class ProductController(IConfiguration _configuration) : ControllerBase
    {
        private static readonly string[] Summaries = new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };




        [HttpGet]
        public IActionResult Get()
        {//{_configuration["a"]
            Console.WriteLine("product的值为"+_configuration["a"]);
            string result = $"--AgileConfigValue Is: {_configuration["a"]} :--[产品服务]{DateTime.Now.ToString()}--+{Request.HttpContext.Connection.LocalIpAddress}" +
                $":{Request.HttpContext.Connection.LocalPort}";
            return Ok(result);
        }

        [HttpGet("error")]
        public IActionResult GetError()
        {
            //   _serviceHelper.GetServices();
            int i = 1, j = 0;
            int res = i / j;
            return Ok(res);
        }


        [HttpGet("GetProductList")]
        public IEnumerable<string> GetProductList()
        {
            return new List<string>() { "ƻ" + Random.Shared.Next(0, 100), "" + Random.Shared.Next(0, 100), "㽶" + Random.Shared.Next(0, 100) };
        }
    }
}
